home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
FishMarket 1.0
/
FishMarket v1.0.iso
/
fishies
/
201-225
/
disk_206
/
stereodemo
/
sources
/
stereo.asm
< prev
next >
Wrap
Assembly Source File
|
1992-05-06
|
64KB
|
2,627 lines
INCLUDE "include:exec/types.i" ;Needed for SOFFSET macro
INCLUDE "Stereo.i"
*Exec Library functions
XREF _intena
XREF _AbsExecBase ;Base address for exec library
XREF _LVOWaitPort
XREF _LVOGetMsg
XREF _LVOPutMsg
XREF _LVOReplyMsg
XREF _WBenchMsg
XREF _LVOOpenLibrary ;exec function to open library
XREF _LVOCloseLibrary
XREF _LVOAllocMem
XREF _LVOFreeMem
XREF _LVODoIO
XREF _LVOSendIO
XREF _LVOCheckIO
XREF _LVOAbortIO
XREF _LVORemove
XREF _LVOAllocSignal
XREF _LVOFreeSignal
XREF _LVOFindTask
XREF _LVOAddTask
XREF _LVORemTask
XREF _LVOOpenDevice
XREF _LVOCloseDevice
XREF _LVOForbid
XREF _LVOPermit
XREF _LVOOpenDiskFont
XREF _LVOCloseFont
*Dos Library functions
XREF _LVOExecute
XREF _LVOOutput ;DOS functions
XREF _LVODelay
XREF _LVOOpen
XREF _LVOClose
XREF _LVOIoErr
XREF _LVOCurrentDir
XREF _LVOParentDir
XREF _LVOExamine
XREF _LVOLock
XREF _LVOUnLock
XREF _LVORead
XREF _LVOWrite
*Graphics Library functions
XREF _LVOSetDrMd
XREF _LVOOwnBlitter
XREF _LVODisownBlitter
XREF _LVOWaitBlit
XREF _LVOAllocRaster
XREF _LVOFreeRaster
XREF _LVOInitView
XREF _LVOInitVPort
XREF _LVOInitBitMap
XREF _LVOGetColorMap
XREF _LVOFreeColorMap
XREF _LVOFreeVPortCopLists
XREF _LVOFreeCprList
XREF _LVOMakeVPort
XREF _LVOMrgCop
XREF _LVOLoadView
XREF _LVOInitRastPort
XREF _LVOMove
XREF _LVODraw
XREF _LVOText
XREF _LVOSetAPen
XREF _LVOSetFont
XREF _LVOWaitBOVP
XREF _LVOBltClear
XREF _LVOLoadRGB4
*Intuition Library functions
XREF _LVOClearScreen
XREF _LVOScreenToFront
XREF _LVOScreenToBack
XREF _LVOOpenWindow
XREF _LVOCloseWindow
XREF _LVORequest
XREF _LVOEndRequest
XREF _LVOGetPrefs
XREF _LVOMoveScreen
XREF _LVOOpenScreen
XREF _LVOCloseScreen
*Translator Library Function
XREF _LVOTranslate
XDEF __Animate3D
IO_QUICK EQU 1 ;Bit 0 set for quick io
NT_MESSAGE EQU 5
gb_ActiView EQU $22
*IDNestCnt EQU $22
MyGadgets EQU WINDOWDRAG!WINDOWDEPTH!WINDOWSIZING ;!WINDOWCLOSE
MyFeatures EQU SMART_REFRESH!ACTIVATE
MyFlags EQU MyGadgets!MyFeatures!WINDOWSIZING
MyFlag EQU MyGadgets!MyFeatures
MODE_OLDFILE EQU 1005
MODE_NEWFILE EQU 1006
MLP1 EQU 33
SIGNFLAG equ $40
MyView EQU V_LACE!V_HIRES
TRUE EQU -1
FALSE EQU 0
CLEAR_PUBLIC EQU MEMF_CHIP!MEMF_CLEAR
Trig_Size EQU 900 ;Enough mem for 450 s.w. degrees
LE_Size EQU $400 ;$200 words for Left Eye
RE_Size EQU $400 ;$200 words for Right Eye
Eye_Size EQU LE_Size+RE_Size
OB_Size EQU 400 ;Output buffer of narrator
TB_Size EQU 164 ;Two lines of centered text
Public_Size EQU nw_SIZE+Trig_Size+Eye_Size+OB_Size+TB_Size ;+ss_SIZEOF
SOLID EQU $FFFF
DOTTED EQU $AAAA
SWidth EQU 640
SHeight EQU 400
S1Width EQU SWidth-1
S1Height EQU SHeight-1
BPDepth EQU 2
CHPADR EQU $DFF000
COP1LCH EQU $80
COPJMP1 EQU $88
DMACONW EQU $96
SETBIT EQU $80
DMACONR EQU $2
INTREQR EQU $1E
DDRA EQU $BFE201 ;DDR for CIAA
SDR EQU $BFEC01 ;Serial data register of CIAA
POT0DAT EQU $12
POT1DAT EQU $14
BLTCON0 EQU $40 ;Control register 0
BLTCON1 EQU $42 ;Control register 1
BLTAFWM EQU $44 ;Blitter first word mask for source A
BLTALWM EQU $46 ;Blitter last word mask for source A
BLTCPTH EQU $48 ;Blitter pointer C (high 3 bits)
BLTCPTL EQU $4A ;Blitter pointer C (low 16 bits)
BLTBPTH EQU $4C ;Blitter pointer B (high 3 bits)
BLTBPTL EQU $4E ;Blitter pointer B (low 16 bits)
BLTAPTH EQU $50 ;Blitter pointer A (high 3 bits)
BLTAPTL EQU $52 ;Blitter pointer A (low 16 bits)
BLTDPTH EQU $54 ;Blitter pointer D (high 3 bits)
BLTDPTL EQU $56 ;Blitter pointer D (low 16 bits)
BLTSIZE EQU $58 ;Start & size (window width, height)
BLTCMOD EQU $60
BLTBMOD EQU $62
BLTAMOD EQU $64
BLTDMOD EQU $66
BLTCDAT EQU $70
BLTBDAT EQU $72
BLTADAT EQU $74
BPL1PTH EQU $E0
BPL1PTL EQU $E2
BPLCON0 EQU $100
BPLCON1 EQU $102
BPLCON2 EQU $104
__Animate3D:
move.l a7,InitSP ;Save initial stack pointer
move.l a6,Savea6 ;Library pointer=0 for icon, FF44A8 for CLI
move.l a5,Savea5
move.l #0,xoffset
move.l _WBenchMsg,a0
move.l a0,WBMsg
move.l sm_ArgList(a0),a0 ;Get pointer to arglist
move.l wa_Name(a0),d1
move.l d1,MyName
move.l WBMsg,d0 ;See if from workbench
bne.s NoCLI
bsr CopyPath
NoCLI: bsr OpenDOS
bsr LibsOpen ;Open Dos, Graphics and Intuition Libraries
bsr GetFont
bsr OpenNew ;Open the new window
* bsr SaveSprite ;Save data of sprite pointer
bsr SpeakPort
bsr ConsolePort
bsr OpenNil
bsr PageTitle
bsr OpenNewScreen
bsr ColorSet
bsr CustomClear
* bset.b #0,SprSts ;Show that pointer is visible
Repeat:
* bsr SpriteClear
AmyName:
move.l #1,DZ
bsr SetMale
lea AmigaName,a5
move.l #90,Theta
move.l #128,DTheta
HexMot: move.l #0,d0
move.l d0,Phi
move.l d0,DPhi
move.l d0,xoffset
move.l d0,yoffset
move.l d0,zoffset
move.w d0,FrmCnt
HexWait:
bsr TriGet
bsr LoadOne
jsr (a5)
bsr EndChk
bsr TriGet
bsr LoadTwo
jsr (a5)
cmp.w #2,FrmCnt
bne.s NotFrst
lea Mes1,a0
move.b #5,d0
SpkThr: bsr TransIt
sub.b #1,d0
bne.s SpkThr
bsr SetFemale
lea AmyTab,a1
move.l (a1)+,a0
move.l a1,CurAmy
bsr Async
NotFrst:
bsr EndChk
bra.s HexWait
CheckIt:
movem.l a0-a6,-(a7)
move.l PendIO,d0
tst.l d0
beq.s NotPnd
move.l _AbsExecBase,a6
move.l SpeakIO,a1
jsr _LVOCheckIO(a6)
tst.l d0 ;See if null returned
beq.s NotPnd ;Actually pending, but not done
move.l d0,a1 ;Address of structure for returned message
jsr _LVORemove(a6) ;d0 should have been equal to a1.
move.l #0,PendIO ;Clear pending status
move.l CurAmy,a1 ;Get address of pointer to next message
move.l (a1)+,d0 ;Get address of next message
beq.s NotPnd
move.l a1,CurAmy
move.l d0,a0
bsr ChkSnd ;Check sound characteristics
bsr Async ;Start next message
NotPnd: movem.l (a7)+,a0-a6
rts
ChkSnd: move.l SpeakIO,a1
cmp.l #AmyFour,d0 ;See if Amy upset on next one.
beq.s FulVol
cmp.l #AmySix,d0
beq.s FulVol
VolNrm: move.w #40,NDI_VOLUME(a1)
cmp.l #DaveThree,d0
* beq SetScreen
beq SetMale
cmp.l #Lst1,d0
beq SetMale
cmp.l #NxtFive,d0
beq SetFemale
cmp.l #NxtEgt,d0
beq SetMale
cmp.l #NxtTen,d0
beq SetFemale
cmp.l #NxtTwl,d0
beq SetMale
cmp.l #NxtFrt,d0
beq SetMale
cmp.l #NxtSxt,d0
beq SetFemale
cmp.l #NxtNnt,d0
beq SetMale
cmp.l #NxtTwt,d0 ;See if we want to move screen up
beq.s SetScreen
cmp.l #NxtThr,d0
bne.s NotSlo
move.w #80,NDI_RATE(a1)
NotSlo: rts
FulVol: move.w #64,NDI_VOLUME(a1)
bsr SetFemale ;Only Amy talks loud
rts
SetScreen:
movem.l d0-d7/a0-a6,-(a7)
bsr SetMale
bsr ScreenUp
movem.l (a7)+,d0-d7/a0-a6
rts
OpenNew:
move.l #Public_Size,d0
bsr StructureAlloc
move.l d0,a2
move.l d0,MyNewWindow ;Store pointer
beq Term ;Terminate program if failed
* bne.s SucAll
* move.l #3,ErrNum
* bra TotalFail ;Can't display if not to this point.
*SucAll: move.l a2,MyNewWindow
bsr.s PointStruct ;Set up pointers for different structures.
bsr.s InitNewWindow ;Initialize new window structure
move.l MyNewWindow,a0
movea.l IntuitionLibrary,a6 ;a6 established by IntuOpen
jsr _LVOOpenWindow(a6) ;Open the new window.
move.l d0,MyWindow ;Pointer to window structure for new window
move.l d0,a0
beq Term ;Terminate if failed to open window
move.l wd_WScreen(a0),a0 ;Get to Work bench screen point
add.l #sc_ViewPort,a0 ;Get up to ViewPort structure
move.l vp_ColorMap(a0),a2 ;Get pointer to colormap structure
move.l cm_ColorTable(a2),a2 ;Get pointer to Color Table
lea SColor,a1
move.l (a2)+,(a1)+
move.l (a2),(a1) ;Store original color table
move.l a0,PortView
rts
OldColor:
lea SColor,a1
bra.s ChColr
NewColor:
lea MCTable,a1
ChColr: move.l a6,-(a7)
move.l PortView,a0
move.l #4,d0
move.l GraphicsLibrary,a6
jsr _LVOLoadRGB4(a6)
move.l (a7)+,a6
rts
InitNewWindow:
bsr TitleTran
move.l MyNewWindow,a2
move.w #SWidth,nw_Width(a2)
move.w #200,nw_Height(a2)
move.b #0,nw_DetailPen(a2) ;Invisible
move.b #1,nw_BlockPen(a2) ;White
move.l #MyFlag,nw_Flags(a2)
move.l WTBuf,d1
move.l d1,nw_Title(a2)
move.w #SWidth,nw_MinWidth(a2)
move.w #100,nw_MinHeight(a2)
move.w #SWidth,nw_MaxWidth(a2)
move.w #200,nw_MaxHeight(a2)
move.w #WBENCHSCREEN,nw_Type(a2)
rts
PointStruct:
adda.l #nw_SIZE,a2 ;Get base for Raster a
* move.l a2,SpriteBuffer ;Save pointer to sprite buffer
* adda.l #ss_SIZEOF,a2
move.l a2,LeftEye
adda.l #LE_Size,a2
move.l a2,RightEye
adda.l #RE_Size,a2
move.l a2,OutBuf
adda.l #400,a2
move.l a2,WTBuf
adda.l #82,a2
move.l a2,StrBuf
adda.l #82,a2
move.l a2,SinTab
adda.l #180,a2 ;Find cosine base
move.l a2,CosTab
lea sintab,a0 ;Locate sine table in file
move.l SinTab,a1 ;Destination of larger table in RAM
move.l #91,d0
MovSin: move.w (a0)+,(a1)+
subq.l #1,d0
bne.s MovSin
rts
StructureAlloc:
move.l a6,-(a7) ;Save a6 (intution library base)
move.l _AbsExecBase,a6 ;Exec functions coming up
move.l #CLEAR_PUBLIC,d1 ;Public memory
jsr _LVOAllocMem(a6)
move.l (a7)+,a6 ;Recover a6
rts
CloseNew:
move.l a6,-(a7)
move.l MyWindow,d0
beq.s NoWind
move.l d0,a0
movea.l IntuitionLibrary,a6
jsr _LVOCloseWindow(a6)
NoWind: move.l _AbsExecBase,a6
move.l MyNewWindow,d0
beq.s NoWdSt
move.l d0,a1
move.l #Public_Size,d0
bsr StructFree
NoWdSt: move.l #0,MyNewWindow
move.l (a7)+,a6
rts
*OpenLib opens the library whose name is pointed to by a1. The library
*base address is returned in d0. a6 is destroyed.
OpenLib:
move.l #MLP1,d0 ;Version 33 or later
movea.l _AbsExecBase,a6
jsr _LVOOpenLibrary(a6) ;Find Library base.
rts ;Library base returned in d0
OpenDOS:
*Open the Dos Library
move.l #DosName,a1 ;Get Dos Name
bsr.s OpenLib
move.l d0,DosLibrary ;Save pointer for it
* beq TotalFail ;Hey it can't even give error messages.
beq Term ;Terminate if failure
rts
LibsOpen:
*Now open intuition
IntuOpen:
move.l #IntuitionName,a1 ;Request intuition library.
bsr.s OpenLib
move.l d0,IntuitionLibrary
beq Term ;Terminate if failed
GraphicsOpen:
* Open the graphics library
move.l #GraphicsName,a1 ;Request graphics library.
bsr.s OpenLib
move.l d0,GraphicsLibrary ;Save pointer
beq Term ;Terminate for failure
GraphOpen:
move.l #TranslatorName,a1
bsr.s OpenLib
move.l d0,TranslatorLibrary
beq Term
TransOpen:
move.l #DiskFontName,a1
bsr.s OpenLib
move.l d0,DiskFontLibrary
beq Term
DFOpen: rts
CloseLibs:
move.l _AbsExecBase,a6 ;Be certain we have exec library
move.l DiskFontLibrary,a1
bsr CloseLib
move.l TranslatorLibrary,a1
bsr CloseLib
move.l GraphicsLibrary,a1
bsr CloseLib ;Close graphics library
move.l IntuitionLibrary,a1
bsr CloseLib ;Close intuition library
rts
CloseDOS:
move.l DosLibrary,a1
CloseLib:
move.l a1,d0
beq.s NotOpen
jsr _LVOCloseLibrary(a6)
NotOpen:
rts
EndChk:
bsr CheckIt
bsr KeyRead
bne.s KeyOne ;0 returned if no new key pressed
rts
KeyOne:
cmp.b #3,d0 ;See if Ctrl C
beq.s Term ;Terminate program if ESC pressed
bclr #5,d0 ;Clear lower-case bit
cmp.b #$49,d0 ;See if I for Intuition
bne.s NoRestore
bsr ResView
NoRestore:
rts ;Return if not I or Control C
AbortIt:
move.l a6,-(a7)
move.l _AbsExecBase,a6
jsr _LVOAbortIO(a6)
move.l (a7)+,a6
rts
Term:
bsr OldColor
move.l #CommandD,d1
bsr DoIt ;Assign c: sys:c
move.l #CommandE,d1
bsr DoIt ;Delete ram:c files
move.l SpeakIO,a1
bsr AbortIt
move.l ConIO,a1
bsr AbortIt
TermIt: move.l #EndCmd,d1 ;Now erase files from ram
bsr DoIt
* bsr RestoreSprite
bsr CloseNewScreen
bsr CloseNil
bsr CloseDevices
bsr CloseNew ;Close new Window
bsr CloseLibs
bsr CloseDOS
move.l Savea5,a5
move.l Savea6,a6
move.l InitSP,a7
rts
CorkScrew:
bsr SetFemale
lea Spiral,a5
bsr LobInp
move.w #0,FrmCnt
move.l SegLength,d0
move.l #0,Theta
move.l #40,ThetaNew
move.l #30,Phi
move.l #0,yoffset
move.l #0,xoffset
move.l #-20000,zoffset
move.l #10,DZ
move.l #2,DTheta
move.l #3,DPhi
Frames:
bsr TriChg
bsr LoadOne
jsr (a5)
bsr EndChk
bsr TriChg
bsr LoadTwo
jsr (a5)
bsr EndChk
cmp.w #100,FrmCnt
bge.s Frames
tst.l DZ ;See if on return trip
bmi.s Frames
lea LstTab,a1
move.l (a1)+,a0
move.l a1,CurAmy
bsr Async
move.w #100,FrmCnt
bra.s Frames
* Vector has inputs of d0 = x1, d1 = y1, d2 = z1, d3 = x2,
* d4 = y2 and d5 = z2. It returns with the first point still in d0 - d2.
Vector: movem.l d0-d2,-(a7)
movem.l d3-d5,-(a7)
move.l d0,xtemp
move.l d1,ytemp
move.l d2,z
bsr Plot3D
movem.l (a7)+,d0-d2
move.l d0,xtemp
move.l d1,ytemp
move.l d2,z
bsr Plot3D
bsr One3D
movem.l (a7)+,d0-d2
rts
* PolyVector adds another 3d line segment. d0-d2 are the next coordinates.
PolyVector:
move.l d0,xtemp
move.l d1,ytemp
move.l d2,z
bra Plot3D
SetUp:
move.w #SOLID,TXTURE
move.w #0,PointCount ;Initialize counter.
move.l #SWidth,d0
lsr.l #3,d0
move.w d0,bytwidth
bsr TabCom
rts
LobInp:
move.l #7,d2
move.l d2,SegLength
move.l #2,DTheta
rts
TriChg: move.l DTheta,d0
add.l d0,Theta
cmp.l #360,Theta
blt.s KepTheta
sub.l #360,Theta
KepTheta:
move.l DPhi,d0
add.l d0,Phi
cmp.l #360,Phi
blt.s KepPhi
sub.l #360,Phi
KepPhi: cmp.l #470,zoffset ;See if already forward
bge.s RevPas
move.l DZ,d0 ;Get Delta Z
bmi.s RevPas
move.l zoffset,d0
bpl.s ZPlus
neg.l d0
asr.l #5,d0
cmp.l #10,d0
bgt.s DZOK
ZPlus: move.l #10,d0
DZOK: add.l d0,zoffset
bra.s TriFnc
RevPas: move.l #-1,DZ
subq.w #1,FrmCnt
move.l zoffset,d0
bpl.s PlusZ
cmp.l #-30000,d0
bgt.s CloseIs
EndLoop:
adda.l #4,a7
move.w LoopCnt,d0
bne Term
bra AmyName
CloseIs:
asr.l #4,d0
cmp.l #-16,d0
blt.s KeepDZ
move.l #-16,d0
KeepDZ: add.l d0,zoffset
bra.s TriFnc
PlusZ: subq.l #8,zoffset
bra.s TriFnc
TriGet
bsr ChangeTheta
TriFnc: lea Theta,a0
move.l (a0),d0
lsl.l #1,d0 ;Offset to address of cosine(theta)
move.l CosTab,a0
adda d0,a0 ;Get address of cosine theta
move.w (a0),d1 ;Get value of cosine(theta)
ext.l d1 ;Make long
asr.l #4,d1
move.w d1,CosTheta
move.l SinTab,a0
adda d0,a0 ;Find sin(theta)
move.w (a0),d1 ;Get sin(theta)
ext.l d1
asr.l #4,d1
move.w d1,SinTheta
lea Phi,a0
move.l (a0),d0
lsl.l #1,d0 ;Offset to address of cosine(theta)
move.l CosTab,a0
adda d0,a0 ;Get address of cosine theta
move.w (a0),d1 ;Get value of cosine(theta)
ext.l d1 ;Make long
asr.l #4,d1
move.w d1,CosPhi
move.l SinTab,a0
adda d0,a0 ;Find sin(theta)
move.w (a0),d1 ;Get sin(theta)
ext.l d1
asr.l #4,d1
move.w d1,SinPhi
rts
GetFont:
move.l a6,-(a7)
move.l IntuitionLibrary,a6
lea PrefBuf,a0
move.l #4,d0
jsr _LVOGetPrefs(a6)
move.b PrefBuf,d0
cmp.b #8,d0 ;See if 80 column mode
beq.s Eighty
move.l #60,PrefBuf
bra.s Sixty
Eighty: move.l #80,PrefBuf
Sixty move.l (a7)+,a6
rts
CustomClear:
move.l #0,TopOffset
move.w #0,BottomOffset
bsr ClearOne
bsr ClearTwo
move.l GraphicsLibrary,a6
move.l MyScreenA,a1
move.b #$FD,d3 ;For raster port mask
lea TitleL,a0
bsr.s ScTitle
move.l MyScreenB,a1
lea TitleL,a0
bsr.s ScTitle
move.b #$FE,d3
move.l MyScreenB,a1
lea TitleR,a0
bsr.s ScTitle
move.l MyScreenA,a1
lea TitleR,a0
bsr ScTitle
move.l #3600,TopOffset
move.w #45,BottomOffset ;Clear all but top 45 lines
rts
ScTitle:
add.l #sc_RastPort,a1
move.b d3,rp_Mask(a1)
move.l a0,-(a7)
move.l #2,d0
move.l a1,-(a7)
jsr _LVOSetDrMd(a6) ;Set to jam 2 so they don't erase
move.l (a7)+,a1 ;each other
move.l ScrFnt,a0
jsr _LVOSetFont(a6) ;Set font and setapen don't destroy
move.l #3,d0 ;a1
jsr _LVOSetAPen(a6)
move.l #200,d0
move.l #14,d1
move.l (a7)+,a0
move.l a1,-(a7)
jsr _LVOMove(a6)
move.l a0,a1
bsr EndFnd
move.l (a7)+,a1
jsr _LVOText(a6)
rts
LoadOne:
move.l MyScreenB,a1 ;B is current forward screen
move.l MyScreenA,a0 ;A is in rear
bsr.s ScrAdj
bra.s ClearTwo
LoadTwo:
move.l MyScreenA,a1 ;Screen A is forward
move.l MyScreenB,a0
bsr ScrAdj ;Adjust B to agree with A
bra ClearOne
ScreenUp:
move.w #175,d1
UpMore: move.l d1,-(a7)
bsr.s ScreensMove
move.l (a7)+,d1
sub.w #5,d1
bge.s UpMore
rts
ScreenDown:
move.w #5,d1
DnMore: move.l d1,-(a7)
bsr.s ScreensMove
move.l (a7)+,d1
add.w #5,d1
cmp.w #180,d1
ble.s DnMore
rts
ScreensMove:
movem.l d0-d1/a0/a6,-(a7)
move.l IntuitionLibrary,a6
move.l MyScreenA,a0
move.w d1,-(a7)
bsr.s ScrnMove
move.w (a7)+,d1
move.w d1,-(a7)
move.l MyScreenB,a0
bsr.s ScrnMove
move.w (a7)+,d1
move.w d1,LastTop
movem.l (a7)+,d0-d1/a0/a6
rts
ScrnMove:
move.w sc_TopEdge(a0),d0
sub.w d0,d1
ext.l d1
move.l #0,d0
jsr _LVOMoveScreen(a6)
rts
ScrAdj: movem.l a0-a1/a6,-(a7)
move.l IntuitionLibrary,a6
* move.l sc_MouseY(a1),d0 ;Get current mouse coordinates
* cmp.l LastMouse,d0
* beq.s NoMouse
* move.l d0,LastMouse
* bsr RestoreSprite
* bra.s KeepSprite
*NoMouse:
* addq.w #1,MouCnt ;Increment frame count for mouse
* cmp.w #30,MouCnt ;See if it's exceeded 30
* blt.s KeepSprite
* bsr SpriteClear
*KeepSprite:
move.w sc_TopEdge(a1),d0 ;Get current top for forward screen
move.w d0,d1 ;Save it in d1
sub.w LastTop,d0 ;Find change
beq.s NoSMov ;No screen movement
move.w d1,LastTop ;Save new top
move.w d0,d1 ;Change into d1
ext.l d1
move.l #0,d0
move.l a0,-(a7)
jsr _LVOMoveScreen(a6) ;Move new screen to agree with other
move.l (a7)+,a0
NoSMov: jsr _LVOScreenToFront(a6) ;Move new screen to front
movem.l (a7)+,a0-a1/a6
rts
Plot3D: move.l z,d0
move.b #10,d3 ;For shifting 10 bits.
move.l d0,d5 ;z is also in d5
muls SinTheta,d5 ;d0 is z*sin(theta)
lea xtemp,a0
move.l (a0),d1 ;d1 is xtemp
move.l d1,d2 ;xtemp is also in d2
muls CosTheta,d2 ;d2 is xtemp*cos(theta)
add.l d2,d5 ;have found xpr
muls CosTheta,d0 ;d0 is z*cos(theta)
muls SinTheta,d1 ;d1 is xtemp*sin(theta)
sub.l d0,d1 ;d1 is now zint
asr.l d3,d5 ;xpr/1024
move.l d5,d0 ;Get xpr back into d0
muls SinPhi,d0 ;Find ypr=xpr*sin(phi)
lea ytemp,a0
move.l (a0),d4 ;Get ytemp
muls CosPhi,d4 ;ytemp*cos(phi)
add.l #50,d4 ;50+ytemp*cos(phi)
add.l d4,d0 ;x = y'+ytemp*cos(phi) in d0
move.w CosPhi,d2
muls d5,d2 ;Find x'*cos(phi)
move.l (a0),d4 ;Get ytemp again.
muls SinPhi,d4 ;Find ytemp*sin(phi)
sub.l d4,d2 ;Find z = x'' for Point3D
asr.l d3,d0 ;Shift x down 10 bits
add.w #320,d0
asr.l d3,d1 ;Shift y down 10 bits
add.w #199,d1 ;Add in offset for y-direction
asr.l d3,d2 ;Shift z down 10 bits to compensate for
; integer trig functions.
add.l xoffset,d0
add.l yoffset,d1
add.l zoffset,d2
neg.l d2 ;Reverse z(actually x)
bra Point3D
* Set3D works exactly as Point3D, except that it places the points directly
* onto the appropriate bit plane, rather than into a buffer area.
* Inputs include d0(x), d1(y), d2(z) and a3(pointer to address of bit plane)
* No values will be destroyed by routine.
Set3D: movem.l d0-d7/a0-a2,-(a7) ;Save the registers
move.w #1024,d4 ;d4 will act as z + z0.
add.w d2,d4 ;Find z + z0
move.w #244,d5 ;d5 will be 244-x
sub.w d0,d5 ;Find 244-x
muls d2,d5 ;Find z*(244-x)
divs d4,d5 ;Find delta-x for left eye
movem.l d0-d2,-(a7) ;Save x, y, & z values
add.w d5,d0 ;Find x for left eye
move.w #199,d5 ;d5 is to be H/2 - y
sub.w d1,d5 ;Find H/2 - y
muls d2,d5 ;Find z*(H/2 - y)
divs d4,d5 ;Find delta-y
add.w d1,d5 ;Find new y-coord.
move.w d5,d1 ;New y in d1
move.w d5,d3 ;Save y in d3
bsr setpix ;Note that setpix uses x=d0, y=d1 and destroys
;d1, d2, & a0. a0 points to absolute address
;where pixel is located in bit plane
movem.l (a7)+,d0-d2 ;Recover x, y, & z.
move.w #394,d5
sub.w d0,d5 ;Find 394-x
muls d2,d5 ;Find z*(394-x)
divs d4,d5 ;Find delta-x for right eye
add.w d5,d0 ;Find new x value for right eye
move.w d3,d1 ;Get y
adda #4,a3 ;Get blue plane address
bsr setpix
suba #4,a3 ;Back to pointer for red plane
movem.l (a7)+,d0-d7/a0-a2 ;Retrieve all registers
rts ;Done for this set of points.
* Point3D takes x, y & z as inputs in registers d0, d1, and d2. It will
* convert these 3 values to 2 sets of coordinates. The 1st is the set
* observed by the left eye and the 2nd is that observed by the right eye.
* These pairs are then stored in the buffer areas lefteye & righteye. A
* point counter is used to offset into these buffers and the counter is
* then incremented. The half separation of the eyes is assumed to be 75
* pixels, and distance between the observer and screen is 1024 pixels.
Point3D:
movem.l d0-d7/a0-a2,-(a7) ;Save the registers
move.w #1024,d4 ;d4 will act as z + z0.
add.w d2,d4 ;Find z + z0
move.w #244,d5 ;d5 will be 244-x
sub.w d0,d5 ;Find 244-x
muls d2,d5 ;Find z*(244-x)
divs d4,d5 ;Find delta-x for left eye
move.w PointCount,d6 ;Find #points so far
add.w d0,d5 ;Find altered x value for left eye
move.l LeftEye,a0 ;Get location of table for left eye
lsl.w #2,d6 ;Allow 4 bytes for combined (x,y)
ext.l d6
adda d6,a0 ;Point to x-coord. for nth point.
move.w d5,(a0)+ ;Store and move up for y-coord.
move.w #199,d5 ;d5 is to be H/2 - y
sub.w d1,d5 ;Find H/2 - y
muls d2,d5 ;Find z*(H/2 - y)
divs d4,d5 ;Find delta-y
add.w d1,d5 ;Find new y-coord.
move.w d5,(a0) ;Store result of y-coord.
movem.l d5,-(a7) ;Push y value
move.w #394,d5
sub.w d0,d5 ;Find 394-x
muls d2,d5 ;Find z*(394-x)
divs d4,d5 ;Find delta-x for right eye
add.w d0,d5 ;Find new x value for right eye
move.l RightEye,a0
adda d6,a0 ;Point to current value
lsr.w #2,d6 ;Get counter back to actual size
addq.w #1,d6 ;Find new count
move.w d6,PointCount ;Store new count
move.w d5,(a0)+ ;Store altered x-value
movem.l (a7)+,d5 ;Recover y-value
move.w d5,(a0) ;Store y-value
movem.l (a7)+,d0-d7/a0-a2 ;Retrieve all registers
rts ;Done for this set of points.
* Poly3D has no inputs in registers. It will complete a sequence of lines
* starting with the first point in the eye buffers and end will the same
* point. The number of points is indicated by PointCount. The effect is
* creating a polygon with N segments when there are N pairs of points stored
* in the eye buffers. Prior to executing, Point3D will have been called at
* least twice.
Poly3D:
move.w PointCount,d7 ;Point counter in d7
move.l LeftEye,a2
move.w (a2)+,d3 ;Get 1st x-value
move.w (a2)+,d4 ;& 1st y-value
ext.l d3
ext.l d4
movem.l d3-d4,-(a7) ;Push 1st point
subq.w #1,d7 ;Decrement count
dispol: move.w (a2)+,d5 ;Get x2
move.w (a2)+,d6 ;& y2
ext.l d5
ext.l d6
bsr AnyLine ;Display line
subq.w #1,d7
bne.s dispol
movem.l (a7)+,d5-d6 ;Recover 1st point as last
bsr AnyLine
adda.l #4,a3 ;Forward to color for right eye
move.w PointCount,d7 ;Point counter in d7
move.l RightEye,a2
move.w (a2)+,d3 ;Get 1st x-value
move.w (a2)+,d4 ;& 1st y-value
ext.l d3
ext.l d4
movem.l d3-d4,-(a7) ;Push 1st point
subq.w #1,d7 ;Decrement count
poldis: move.w (a2)+,d5 ;Get x2
move.w (a2)+,d6 ;& y2
ext.l d5
ext.l d6
bsr AnyLine ;Display line
subq.w #1,d7
bne.s poldis
movem.l (a7)+,d5-d6 ;Recover 1st point as last
bsr AnyLine
suba.l #4,a3 ;Backward to color for left eye
move.w #0,PointCount
rts
*Lines3D is identical to Poly3D, except the polygon isn't closed. Therefore,
* the line sequence ends on the last point
Lines3D:
move.w PointCount,d7 ;Point counter in d7
move.l LeftEye,a2
move.w (a2)+,d3 ;Get 1st x-value
move.w (a2)+,d4 ;& 1st y-value
ext.l d3
ext.l d4
movem.l d3-d4,-(a7) ;Push 1st point
subq.w #1,d7 ;Decrement count
dislin: move.w (a2)+,d5 ;Get x2
move.w (a2)+,d6 ;& y2
ext.l d5
ext.l d6
bsr AnyLine ;Display line
subq.w #1,d7
bne.s dislin
movem.l (a7)+,d5-d6 ;Recover 1st point as last
adda.l #4,a3 ;Forward to color for right eye
move.w PointCount,d7 ;Point counter in d7
move.l RightEye,a2
move.w (a2)+,d3 ;Get 1st x-value
move.w (a2)+,d4 ;& 1st y-value
ext.l d3
ext.l d4
movem.l d3-d4,-(a7) ;Push 1st point
subq.w #1,d7 ;Decrement count
lindis: move.w (a2)+,d5 ;Get x2
move.w (a2)+,d6 ;& y2
ext.l d5
ext.l d6
bsr AnyLine ;Display line
subq.w #1,d7
bne.s lindis
movem.l (a7)+,d5-d6 ;Recover 1st point as last
suba.l #4,a3 ;Backward to color for left eye
move.w #0,PointCount
rts
* One3D has no inputs in registers. It will draw one 3D line starting with
* the first point in the eye buffers and ending with the 2nd point. Prior
* to executing, Point3D will have been called exactly twice.
One3D:
move.l LeftEye,a2
move.w (a2)+,d3 ;Get 1st x-value
move.w (a2)+,d4 ;& 1st y-value
ext.l d3
ext.l d4
move.w (a2)+,d5 ;Get x2
move.w (a2)+,d6 ;& y2
ext.l d5
ext.l d6
bsr AnyLine ;Display line
adda.l #4,a3 ;Forward to color for right eye
move.l RightEye,a2
move.w (a2)+,d3 ;Get 1st x-value
move.w (a2)+,d4 ;& 1st y-value
ext.l d3
ext.l d4
move.w (a2)+,d5 ;Get x2
move.w (a2)+,d6 ;& y2
ext.l d5
ext.l d6
bsr AnyLine ;Display line
suba.l #4,a3 ;Backward to color for left eye
move.w #0,PointCount
rts
noline: rts
* vertline will have its inputs as x1(d3),y1(d4),y2(d5) with x2=x1
vertline:
cmp.l d4,d6 ;See if only point
beq.s noline
movem.l d3-d6,-(a7) ;Push current values
move.l #1,d2 ;Will be in quadrant 2 if plus
sub.w d4,d6 ;Find y2 - y1
bpl.s postiv ;Already plus
move.l #3,d2 ;4th quadrant if negative
neg.w d6 ;Make delta-y plus
postiv: move.w d3,d0 ;Get x1 into d0
move.w d4,d1 ; & y1 into d1
move.w #SHeight,d3 ;Get screen height in d3
cmp.w #400,d3 ;See if interlace
beq.s samkep ;Keep same if interlace
asr.w #1,d6 ;Halve delta-y
samkep: move.w d6,d3 ;d3 has delta-y (as deltax in NewLine)
move.w #0,d4 ;deltay in NewLine is 0
addi.l #4,d2 ;Offset for steep slopes
lsl.l #1,d2 ;Double offset
lea octcod,a1 ;Get table location
adda d2,a1 ;Find pointer to table
move.w (a1),d2 ;Get octant code
ori.w #SIGNFLAG,d2 ;Set sign flag
bsr NewLine
movem.l (a7)+,d3-d6 ;Pop values
move.l d5,d3 ;Get x2 into x1
move.l d6,d4 ;Get y2 into y1
rts
* AnyLine will take input for x1 in d3, y1 in d4, x2 in d5 and y2 in d6
* It will determine if the slope is 0 or infinite and accordingly branch
* to horzline or vertline. If neither, it will determine the values for
* delta-x and delta-y, determine the quadrant and call NewLine.
AnyLine:
cmp.w d3,d5 ;See if x1=x2
beq vertline
cmp.w d4,d6 ;See if y1=y2
beq horzline
movem.l d3-d5,-(a7)
move.w #0,d2 ;Quadrant # 0 to start with
move.w d3,d0 ;x1 into d0
move.w d4,d1 ;y1 into d1
move.w d5,d3 ;x2 into d3
move.w d6,d4 ;y2 into d4
sub.w d0,d3 ;Find delta-x
ishirs: tst.w d3 ;See if negative
bmi.s quad23 ;If negative its in 2nd or 3rd quadrant
quad14: sub.w d1,d4 ;Find delta-y
isintl: tst.w d4
bmi.s quad4 ;It's quadrant 4
quad1: move.l #0,d2
bra octsel ;It's quadrant 1, n = 0
quad4: move.l #3,d2 ;It's quadrant four
neg.w d4 ;Make delta-y +
bra octsel
quad23: sub.w d1,d4 ;Find delta-y
intoo: tst.w d4 ;See if -
bmi.s quad3
quad2: move.l #1,d2
neg.w d3 ;Make delta-x +
bra octsel
quad3: move.l #2,d2 ;Quadrant number is 3
neg.w d3 ;Make deltax +
neg.w d4 ;Same for delta y
octsel: cmp.w d3,d4 ;See if delta-x less than delta-y
bmi.s smallslope
add.l #4,d2 ;Add in 4 more through table
move.l d3,-(a7) ;Push delta x
move.l d4,d3 ;Get delta y into delta x
move.l (a7)+,d4 ;Pop as delta y
smallslope:
lsl.l #1,d2 ;Go to select octant
lea octcod,a1
adda d2,a1
move.w (a1),d2 ;Get octant code
bsr NewLine ;Draw line
movem.l (a7)+,d3-d5
move.w d5,d3 ;Make x1 = old x2
move.w d6,d4 ;Make y1 = old y2
rts
* horzline will have its inputs as x1(d3),y1(d4),x2(d5) with y2=y1
* d2 will contain the value of delta-x
horzline:
movem.l d3-d7,-(a7) ;Push current values
move.l #0,d2 ;Quadrant 1 if y1>y2
sub.w d3,d5 ;Find deltax
bpl.s plus ;Already plus
move.l #2,d2 ;Quadrant 4 is -
neg.w d5 ;Make deltax +
plus: move.w d3,d0 ;Get x1 into d0
move.w d4,d1 ;& y1 into d1
move.w #SWidth,d3 ;Get screen width into d3
cmp.w #640,d3 ;See if high res.
beq.s kepsam
lsr.w #1,d5 ;Halve delta x
kepsam:
move.w d5,d3
move.w #0,d4 ;Make deltay = 0
lsl.l #1,d2 ;Double offset
lea octcod,a1
adda d2,a1 ;Find pointer to table
move.w (a1),d2 ;Get octant code
ori.w #SIGNFLAG,d2
bsr NewLine
movem.l (a7)+,d3-d7
okay: move.l d5,d3 ;Get x2 into x1
move.l d6,d4 ;Get y2 into y1
rts
ResView:
movem.l d0-d7/a0-a6,-(a7)
move.l #CommandD,d1
bsr DoIt ;Do assign c: sys:c
* bsr RestoreSprite
move.l IntuitionLibrary,a6
move.l MyScreenA,a0
jsr _LVOScreenToBack(a6) ;Hide both custom screens.
move.l MyScreenB,a0
jsr _LVOScreenToBack(a6)
lea HomeIt,a0
bsr StrWrite
lea Caution,a0
bsr TransIt
lea MyString,a0
bsr TransIt
bsr SpcWait
* bsr SpriteClear
move.l #CommandC,d1
bsr DoIt ;Do assign c: ram:c
movem.l (a7)+,d0-d7/a0-a6
rts
MyDelay:
move.l a6,-(a7)
move.l DosLibrary,a6
move.l #200,d1
jsr _LVODelay(a6)
move.l (a7)+,a6
rts
*setpix has inputs of d0.w for x, d1.w for y, and a3 for the video pointer
* Registers affected include d1, d2, and a0. It returns with the address
* of the pixel in a0 and the bit to be set or cleared in d1
setpix:
move.w d1,d2 ;See if y is - and get into d2
bmi.s setnot ;Don't set if negative
intlce: move.w #S1Height,d2
sub.w d1,d2 ;*;Find 199-y
bcs.s setnot ;* ;Don't set if y1 > yupper.
move.w d1,d2
move.w d0,d1 ;See if x is negative
bmi.s setnot ;Don't set if is
cmp.w #S1Width,d0
bgt.s setnot ;bcc.s setnot ;If no carry then too big
move.w d2,d1 ;Save y in d1
lsl.w #6,d1 ;d1 is 32y
lsl.w #4,d2 ;d2 is 8y
add.w d1,d2 ;d2 is 80y (40y)
nrmres: move.w d0,d1 ;d1 is x
lsr.w #3,d1 ;d1 is x/8
add.w d1,d2 ;d2 is offset for memory location
move.l (a3),a0 ;Point to beginning of memory****was (a3)
adda.l d2,a0 ;Add in offset
move.w d0,d1 ;d1 is x
eori.w #7,d1 ;Toggle lowest 3 bits.
andi.w #7,d1 ;Get 7 - x(mod 8)
bset d1,(a0) ;Set bit 7-x(mod8)
setnot: rts
TabCom:
move.l CosTab,a0 ;Get beginning of Cos and end of Sin
move.l a0,a1
move.w (a1)+,d0 ;Move destination up 1 word.
move.b #90,d0
movtab: move.w -(a0),(a1)+ ;Transfer 1 word of table
subq.b #1,d0 ;Decrement counter
bne.s movtab ;Repeat until 89 values moved.
move.l SinTab,a0
move.l CosTab,a1
adda #180,a1 ;Point to cosine 90 degrees
move.w #272,d0
tabmov: move.w (a0)+,d1
neg.w d1
move.w d1,(a1)+ ;Store - sine
subq.w #1,d0
bne.s tabmov ;Now have through sine(360)
move.l CosTab,a0
adda #180,a0 ;Point to cos(90)
move.w #0,(a0) ;0 sin(180)
rts
ClearOne:
move.l PnPtr0,a3
move.l a3,PagNum
bra.s clears ;Plane both of bit planes for page one
ClearTwo:
move.l PnPtr1,a3
move.l a3,PagNum
clears: move.l a3,a0
move.l #0,d3
bsr.s clearshort
move.l a3,a0
move.l #1,d3
clearshort:
movem.l d0-d1,-(a7)
move.l d3,d1 ;Get bit plane number into d1
lsl.l #2,d1 ;Quadruple offset
adda d1,a0
movea.l (a0),a1 ;Get address of screen.
adda.l TopOffset,a1 ;# bytes = 80 times #lines
move.w #SHeight,d0 ;Get screen height
* sub.w #54,d0 ;Less 74 scan lines
sub.w BottomOffset,d0
mulu #SWidth,d0 ; times width
lsr.l #3,d0 ;Find number of bytes
move.l #1,d1 ;Set up flags for waiting on blitter.
*Note: BltClear does not cause the problem with disk access.
jsr _LVOBltClear(a6) ;Clear the screen.
movem.l (a7)+,d0-d1
rts
*DrawNot will be reached if x1 or y1 is negative, or if both delta-x &
* delta-y are 0.
DrawNot:
rts
* NewLine has inputs as follows. x1, y1 in d0 & d1 for input to setpix
*d2 has the octant number, with d3 & d4 being delta-x & delta-y respectively
NewLine:
ori.w #1,d2 ;Line mode,solid line
* Will use ori.w #3 for single bit/scanline
move.w d2,(BLTCON1+CHPADR)
bsr setpix
move.l a0,(BLTCPTH+CHPADR) ;a0 has pixel location
move.l a0,(BLTDPTH+CHPADR)
andi.w #$F,d0 ;Mask off above 15.
move.b #12,d5 ;Want to shift 12 bits.
lsl.w d5,d0 ;d0 now has start position.
* ori.w #$BFA,d0 ;Add in start position to #$B4A
ori.w #$BC8,d0
* $4A is used for ((not A and B) or (AB and not C)
* $FA would be used for A or C, and $C8 for (A + C)B == texture
move.w d0,(BLTCON0+CHPADR)
move.w d4,d1 ;Get dy
bmi.s DrawNot ;No - dy allowed
move.w d3,d0 ;Get dx
bmi.s DrawNot
or.w d0,d1 ;Or deltax & deltay
beq.s DrawNot ;Don't draw if both 0
* move.l a6,-(a7) ;Save Lib pointer
* move.l _AbsExecBase,a6 ;Get exec lib.
move.w d4,d1 ;Get dy again
sub.w d0,d1 ;d(y-x) into d1
asl.w #2,d1 ;4*d(y-x) into d1
move.w d1,(BLTAMOD+CHPADR);Store 4(y-x) in BLTAMOD
move.w d4,d1 ;Get dy again
asl.w #2,d1 ;4dy in d1
move.w d1,(BLTBMOD+CHPADR)
move.w #$8000,(BLTADAT+CHPADR) ;Index register
move.w TXTURE,(BLTBDAT+CHPADR) ;Solid lines
asl.w #1,d4 ;Find 2dy
sub.w d3,d4 ;2y-x ind d4 now
move.w d4,(BLTAPTL+CHPADR) ;2y-x into BLTAPTL
move.w bytwidth,(BLTCMOD+CHPADR) ;#$50,(BLTCMOD+CHPADR) ;Screen width
move.w bytwidth,(BLTDMOD+CHPADR) ;#$50,(BLTDMOD+CHPADR)
move.l #$FFFFFFFF,(BLTAFWM+CHPADR) ;Make mask high for 1st & last
move.w #$8140,d0 ;Code for blitter enable.
asl.w #6,d3 ;Shift left 6 bits (64 delta-x)
ori.w #2,d3 ;Set line draw bit.
DskChk: move.w (INTREQR+CHPADR),d1 ;Check request status for disk
btst #4,d1 ;See if request pending
bne.s DskChk ;Wait until not requested.
StsWat: move.w (DMACONR+CHPADR),d1 ;Get enable status
btst #4,d1 ;Keep checking until DSKEN off
beq.s StsWat
btst #14,d1 ;See if busy
bne.s StsWat
or.w d1,d0 ;Keep status same for copper, etc.
bset #10,d0 ;Turn on blitter nasty
* move.w #$4000,_intena
* addq.b #1,IDNestCnt(a6)
ntnst4: move.w d0,(DMACONW+CHPADR) ;Enable the blitter.
move.w d3,(BLTSIZE+CHPADR) ;Send out line size to start it.
watsts: move.w (DMACONR+CHPADR),d0 ;Get current status
btst #14,d0 ;See if busy
bne.s watsts
* subq.b #1,IDNestCnt(a6)
* bge.s EnableDone
* move.w #$C000,_intena
EnableDone:
* move.l (a7)+,a6 ;Recover library pointer
rts ;Back to work.
NxtPnt: move.l (a4)+,d0
move.l (a4)+,d1
move.l #0,d2
move.l a4,-(a7)
bsr PolyVector
move.l (a7)+,a4
rts
AmigaName:
movem.l d0-d5/a4,-(a7)
lea AName,a4
bsr.s ClosedPoly ;Outer part of 1st A
bsr.s ClosedPoly ;Inner part of 1st A
bsr.s ClosedPoly ;M
bsr.s ClosedPoly ;I
bsr.s ClosedPoly ;G
bsr.s ClosedPoly ;Exterior of 2nd A
bsr.s ClosedPoly ;Interior of 2nd A
movem.l (a7)+,d0-d5/a4
rts
ClosedPoly:
move.l #0,d2
move.l #0,d5
PolyClose:
move.w (a4)+,d1
move.w (a4),d0
ext.l d0
ext.l d1
move.l d1,FirstY
move.l d0,FirstX
subq.w #2,a4
DoLine: move.w (a4)+,d1
move.w (a4)+,d0
move.l a4,-(a7) ;Save beginning point
ext.l d0
ext.l d1
move.w (a4)+,d4
move.w (a4)+,d3
ext.l d3
ext.l d4
cmp.l FirstY,d4 ;See if last point
bne.s NotLast
cmp.l FirstX,d3
beq.s LastPoint
NotLast:
movem.l d2/d5,-(a7)
bsr Vector
movem.l (a7)+,d2/d5
move.l (a7)+,a4
bra.s DoLine
LastPoint:
bsr Vector
move.l (a7)+,a4
addq.l #4,a4 ;Get to beginning of next table
rts
Spiral:
lea ThetaTotal,a0
move.l #0,(a0) ;Initial value of theta
NxtSprl:
move.l a0,-(a7)
bsr Rosette
bsr Plot3D
move.l (a7)+,a0
move.l DTheta,d0
add.l d0,(a0)
cmp.l #180,(a0) ;ytemp
ble.s NxtSprl
bsr Lines3D
ThetaChange:
addq.l #8,ThetaNew
cmp.l #360,ThetaNew
blt.s NewOK
sub.l #360,ThetaNew
NewOK: rts
ChangeTheta:
move.l DTheta,d0
lsr.l #5,d0
cmp.w #135,FrmCnt
bge.s LT180
cmp.w #45,FrmCnt
blt.s LT180
add.l d0,Theta
cmp.l #360,Theta
ble.s OKTheta
sub.l #360,Theta
bra.s OKTheta
LT180: sub.l d0,Theta
bpl.s OKTheta
add.l #360,Theta
OKTheta:
move.l DPhi,d0
lsr.l #5,d0
add.l d0,Phi
cmp.l #360,Phi
blt.s OKPhi
sub.l #360,Phi
OKPhi: move.l SinTab,a0
move.l CosTab,a1
move.l Theta,d0
lsl.l #1,d0 ;Get offset in trig table.
add.l d0,a1
add.l d0,a0
move.w (a0),d1 ;Get sin
move.w (a1),d0 ;Get cos
ext.l d0
ext.l d1
asr.l #7,d0
asr.l #7,d1 ;Get actual value times 128
bsr MakChg
move.l d0,yoffset
move.l d1,zoffset
addq.w #1,FrmCnt
rts
MakChg:
add.l #64,d1
cmp.w #135,FrmCnt
bge.s GT540
cmp.w #45,FrmCnt
bge.s SecHal
GT540: neg.l d0
cmp.w #180,FrmCnt
blt.s ChgDon
bne.s Not180
ChkPnd: move.l PendIO,d0 ;See if anything pending
beq.s MesDon
bsr CheckIt
bra.s ChkPnd
MesDon: bsr SetMale
lea Mes3,a0
move.b #7,d0
NxMes3: bsr TransIt
sub.b #1,d0
bne.s NxMes3
bsr SetFemale
Not180: add.l #1,DTheta
add.l #1,DPhi
move.l yoffset,d0
move.l zoffset,d1
tst.l DZ
ble Retrip
sub.l DZ,d1
add.l #1,DZ
cmp.l #-4000,d1
bgt.s IsClose
neg.l DZ
lea TabAmy,a1
move.l (a1)+,a0
move.l a1,CurAmy
bsr Async
IsClose:
move.l #0,d0
ChgDon: rts
SecHal: add.l #128,d1
neg.l d1
rts
Retrip: cmp.w #1024,FrmCnt
bge EndLst ;End of last (actually next to last) sequence
tst.l DZ
beq.s LstPas
sub.l DZ,d1
add.l #1,DZ
bsr CheckIt
cmp.l #-100,d1
ble.s IsClose
move.l #0,DZ
ChkPd2: move.l PendIO,d2 ;See if io still pending
beq.s IO2Don
bsr CheckIt
bra.s ChkPd2
IO2Don: bsr SetMale
lea DaveTab,a1
move.l (a1)+,a0
move.l a1,CurAmy
bsr Async
bra.s IsClose
LstPas:
move.l PendIO,d2 ;Get io status
bne.s IsClose
cmp.w #1000,FrmCnt
blt StrtLst
bra IsClose
StrtLst:
bsr Second
bsr Third
bsr SetFemale
lea LateAmy,a1
move.l (a1)+,a0
move.l a1,CurAmy
bsr Async
bsr NewColor
move.w #1000,FrmCnt
bsr ScreenDown
move.l #-600,d1 ;Move further away
bra IsClose
EndLst: cmp.w #4000,FrmCnt ;See if on last pass
bgt.s PasLst
bsr CheckIt
move.l PendIO,d2
bne IsClose
move.w #4000,FrmCnt ;Start frame count high
* bsr ScreenUp
PasLst: cmp.w #4030,FrmCnt
ble IsClose
adda.l #12,a7 ;Balance Stack
bra CorkScrew
Rosette:
movem.l d0-d3/a0-a2,-(a7)
move.b #8,d3
move.w Leaf,d1 ;Count of # of leaves
bsr SinGet
move.w d0,rho ;Store 64*cos(3*theta) in rho
move.w #1,d1
bsr CosGet
muls rho,d0
asr.l d3,d0
move.l d0,xtemp
bsr SinGet
muls rho,d0
asr.l d3,d0
move.l d0,ytemp
move.w rho,d0
muls d0,d0
move.w #1,d1
move.l ThetaNew,d2
move.l d0,d5
move.l (a0),d4
move.l d2,(a0)
bsr.s CosGet
move.l d4,(a0)
muls d5,d0
asr.l d3,d0
sub.b #1,d3
asr.l d3,d0
move.l d0,z
movem.l (a7)+,d0-d3/a0-a2
rts
CosGet:
move.l CosTab,a1
TrgVal: move.l (a0),d0 ;Get theta
lsl.l #1,d0 ;Double for short word table
muls d1,d0 ;Include multiplier
ChkSiz: cmp.l #720,d0 ;See if beyond table
ble.s SmlEnf
sub.l #720,d0
bra.s ChkSiz
SmlEnf: add.l d0,a1 ;Get sine location
move.w (a1),d0 ;Get trig value
ext.l d0
asr.l #7,d0
rts
SinGet:
move.l SinTab,a1
bra.s TrgVal
SetWhite:
lea WhiteScript,a0
bsr StrWrite
rts
SetOrange:
lea OrangeScript,a0
bsr StrWrite
rts
PageTitle:
move.l GraphicsLibrary,a6
bsr SetWhite
lea LinFed,a0
bsr StrWrite
lea IntMes0,a0
move.l #4,d3
bsr CtrBlock
bsr SetOrange
lea IntMes1,a0
move.l #1,d3
bsr CtrWrite
bsr CopyFiles
lea MenStr,a0
bsr TransIt
bsr TransIt
bsr SetWhite
lea IntMes2,a0
move.l #2,d3
bsr CtrBlock
bsr SetUp
lea AnCmd,a0
bsr TabWrite
bsr TabWrite
lea Remem,a0
bsr TransIt
bsr TransIt
lea DefStr,a0
bsr TransIt
bsr TransIt
lea SpcStr,a0
bsr CtrWrite
* Wait for keyboard input
Wait: move.l #0,MyBuffer ;Clear input buffer
move.l ConIO,a1
move.l #0,IO_ACTUAL(a1)
move.w #20,d3
move.w #1,LoopCnt ;Default value
WaitSpc:
move.w d3,-(a7)
bsr.s ShrtDelay
bsr KeyRead ;Read single key using quick-io
move.w (a7)+,d3
cmp.b #$20,d0
beq.s WasSpc
subq.w #1,d3
bne.s WaitSpc
move.l ConIO,a1
bsr.s AbortIt
move.l #0,MyBuffer
rts
WasSpc: move.l ConIO,a1
bsr.s AbortIt
move.w #0,LoopCnt
move.l #0,MyBuffer ;Flush buffer
rts
SpcWait:
move.l #0,MyBuffer ;Clear input buffer
move.l ConIO,a1
move.l #0,IO_ACTUAL(a1)
WaitHere:
bsr KeyRead ;Read single key using quick-io
cmp.b #$20,d0
beq.s WasSpc
bra.s WaitHere ;SpcWait only acknowledges space bar
ShrtDelay:
move.l a6,-(a7)
move.l DosLibrary,a6
move.l #10,d1
jsr _LVODelay(a6)
move.l (a7)+,a6
rts
*SaveSprite:
* move.w #$120,d1
* move.w #$122,d2
* move.l #0,a0
*DoSrch: move.w (a0)+,d3
* cmp.w d1,d3
* bne.s DoSrch
* move.w (a0)+,d0 ;Move past data word
* move.w (a0),d3
* cmp.w d2,d3
* bne.s DoSrch
* suba #2,a0 ;Back up to SPR0PTH
* move.l (a0)+,d0 ;Get value of SPR0PTH
* move.l d0,(SpriteSave) ;Store msw
* move.w (a0),d1 ;Get lsw of pointer (i.e. SPR0PTL)
* move.w d1,(SpriteSave+2)
* move.l (SpriteSave),a0 ;Get address of pointer
* adda #4,a0 ;Move up to table for sprite
* move.l a0,(SpriteSave)
* move.l SpriteBuffer,a1 ;Point to buffer for saving sprite data.
* move.b #16,d1 ;Counter for number of words to move.
* bra.s blkmov ;Transfer data of original sprite
*SpriteClear:
* btst.b #0,SprSts
* beq.s IsCler
* move.b #16,d1
* move.l (SpriteSave),a0
*bufclr: move.l #0,(a0)+
* subq.b #1,d1
* bne.s bufclr
* move.l MyScreenA,a0
* move.l sc_MouseY(a0),d0
* move.l d0,LastMouse
* move.w #0,MouCnt
* bclr.b #0,SprSts
*IsCler: rts
*RestoreSprite:
* btst.b #0,SprSts ;See if pointer already displayed.
* bne.s SprtOn
* movem.l a0-a1,-(a7)
* move.l (SpriteSave),a1 ;Get address of pointer
* move.l SpriteBuffer,a0 ;Pointer to buffer for recover sprite data
* move.b #16,d1 ;Counter for number of words to move.
* bsr blkmov
* movem.l (a7)+,a0-a1
*SprtOn: bset.b #0,SprSts
* rts
*blkmov:
* move.l (a0)+,(a1)+
* subq.b #1,d1 ;Decrement counter
* bne.s blkmov
* rts
PortCreate:
move.l #-1,d0
jsr _LVOAllocSignal(a6)
move.l d0,Signal
cmp.l #-1,d0
beq.s NoSignal
move.l #MP_SIZE,d0
bsr StructureAlloc
move.l d0,MsgPort
beq.s MemFail
move.l d0,a2
move.l #0,LN_NAME(a2)
move.b #0,LN_PRI(a2)
move.b #NT_MSGPORT,LN_TYPE(a2)
clr.b MP_FLAGS(a2)
move.l Signal,d0
move.b d0,MP_SIGBIT(a2)
NoSignal:
rts
TaskFind:
move.l #0,a1
jsr _LVOFindTask(a6)
move.l d0,MP_SIGTASK(a2)
move.l a2,a0
add.l #MP_MSGLIST,a0
move.l a0,(a0)
addq.l #4,(a0)
clr.l 4(a0)
move.l a2,d0
rts
MemFail:
move.l Signal,d0
jsr _LVOFreeSignal(a6)
rts
PortDelete:
move.l MsgPort,d0
beq.s NoPort
move.l d0,a1
move.b #-1,LN_TYPE(a1)
moveq #-1,d2
move.l d2,MP_MSGLIST(a1)
moveq #0,d2
move.b MP_SIGBIT(a1),d0
jsr _LVOFreeSignal(a6)
move.l #MP_SIZE,d0
move.l MsgPort,a1
bsr StructFree
move.l #0,MsgPort
NoPort: rts
SpeakPort:
move.l a6,-(a7)
move.l _AbsExecBase,a6
move.l #NDI_SIZE,d0
bsr StructureAlloc
move.l d0,SpeakIO ;Save pointer to IO request block
bsr PortCreate
bsr TaskFind
move.l MsgPort,a1
move.l a1,MsgPortN
move.l Signal,a1
move.l a1,SignalN
move.l SpeakIO,a1
move.b #NT_MESSAGE,LN_TYPE(a1)
move.l d0,MN_REPLYPORT(a1)
move.w #MP_SIZE,MN_LENGTH(a1)
lea NarDev_Name,a0
move.l SpeakIO,a1
bsr.s DeviceOpen
move.l SpeakIO,a1
move.l OutBuf,d0
move.l d0,IO_DATA(a1)
move.w #CMD_WRITE,IO_COMMAND(a1) ;Set up for output audio $
lea AudChn,a0
move.l a0,NDI_CHMASKS(a1)
move.w #4,NDI_NUMMASKS(a1)
move.w #40,NDI_VOLUME(a1)
* move.w #21000,NDI_SAMPFREQ(a1)
* bsr SetMale
move.l (a7)+,a6
rts
SetMale:
move.l a1,-(a7)
move.l SpeakIO,a1
move.w #MALE,NDI_SEX(a1)
move.w #DEFFREQ,NDI_SAMPFREQ(a1)
move.w #110,NDI_PITCH(a1)
move.w #160,NDI_RATE(a1)
move.l (a7)+,a1
rts
SetFemale:
move.l a1,-(a7)
move.l SpeakIO,a1
* move.w #MAXFREQ,NDI_SAMPFREQ(a1)
move.w #24000,NDI_SAMPFREQ(a1)
move.w #FEMALE,NDI_SEX(a1)
move.w #190,NDI_PITCH(a1)
move.w #170,NDI_RATE(a1)
move.l (a7)+,a1
rts
ConsolePort:
move.l a6,-(a7)
move.l _AbsExecBase,a6
move.l #IOSTD_SIZE,d0
bsr StructureAlloc
move.l d0,ConIO ;Save pointer to IO request block
bsr PortCreate
bsr TaskFind
move.l MsgPort,a1
move.l a1,MsgPortC
move.l Signal,a1
move.l a1,SignalC
lea ConDev_Name,a0
move.l ConIO,a1
move.b #NT_MESSAGE,LN_TYPE(a1)
move.l d0,MN_REPLYPORT(a1)
move.w #MP_SIZE,MN_LENGTH(a1)
move.l MyWindow,d0
move.l d0,IO_DATA(a1)
bsr.s DeviceOpen
move.l (a7)+,a6
rts
DeviceOpen:
move.l #0,d0
move.l #0,d1
jsr _LVOOpenDevice(a6)
rts
CloseDevices:
move.l a6,-(a7)
move.l _AbsExecBase,a6
move.l SpeakIO,d1
move.l #NDI_SIZE,d0
bsr.s DeviceClose
move.l SignalN,d0
move.l #0,SpeakIO
move.l d0,Signal
move.l MsgPortN,d0
move.l d0,MsgPort
bsr PortDelete
move.l ConIO,d1
move.l #IOSTD_SIZE,d0
bsr.s DeviceClose
move.l #0,ConIO
move.l SignalC,d0
move.l d0,Signal
move.l MsgPortC,d0
move.l d0,MsgPort
bsr PortDelete
move.l (a7)+,a6
rts
DeviceClose:
move.l d1,a1 ;See if 0
beq.s WasCl
movem.l d0/a1,-(a7) ;Save pointer to IOReqStr
jsr _LVOCloseDevice(a6)
movem.l (a7)+,d0/a1 ;Recover IOReqStr pointer and Size
bsr StructFree
WasCl: rts
Async:
movem.l d0-d7/a1-a6,-(a7)
move.l TranslatorLibrary,a6
move.l a0,a1
bsr.s EndFnd
move.l a1,-(a7) ;Save beginning of next string
move.l OutBuf,a1
move.l #400,d1 ;Output buffer 200 bytes long
jsr _LVOTranslate(a6)
move.l OutBuf,a1
bsr.s EndFnd
move.l #1,PendIO ;Indicate IO is active
move.l SpeakIO,a1
move.l _AbsExecBase,a6
move.l d0,IO_LENGTH(a1)
jsr _LVOSendIO(a6)
move.l (a7)+,a0 ;Recover beginning of next string.
movem.l (a7)+,d0-d7/a1-a6
rts
TransIt:
movem.l d0-d7/a1-a6,-(a7)
move.l TranslatorLibrary,a6
move.l a0,a1
bsr.s EndFnd
move.l a1,-(a7) ;Save beginning of next string
move.l OutBuf,a1
move.l #400,d1 ;Output buffer 200 bytes long
jsr _LVOTranslate(a6)
move.l OutBuf,a1
bsr.s EndFnd
move.l SpeakIO,a1
move.l _AbsExecBase,a6
move.l d0,IO_LENGTH(a1)
jsr _LVODoIO(a6)
move.l (a7)+,a0 ;Recover beginning of next string.
movem.l (a7)+,d0-d7/a1-a6
rts
EndFnd: move.l #0,d0
move.l d0,d2
NxtByt: move.b (a1)+,d1 ;Get translated code
beq.s CodDon
addq.l #1,d0
cmp.b #$a,d1
beq.s NxtByt
addq.l #1,d2
bra.s NxtByt
CodDon: rts
KeyRead:
movem.l a1/a6,-(a7)
move.l ConIO,a1
move.l _AbsExecBase,a6
move.l #MyBuffer,IO_DATA(a1)
move.l #1,IO_LENGTH(a1)
move.w #CMD_READ,IO_COMMAND(a1)
move.b #IO_QUICK,IO_FLAGS(a1)
jsr _LVOSendIO(a6)
* jsr _LVODoIO(a6)
move.b MyBuffer,d0
move.l IO_ACTUAL(a1),d1 ;Get #bytes
movem.l (a7)+,a1/a6
rts
CtrBlock:
move.l d3,-(a7)
bsr CtrWrite
move.l (a7)+,d3
subq.l #1,d3
bne.s CtrBlock
rts
TitleTran:
lea NewWindTitle,a0
move.l WTBuf,a1
move.l a1,-(a7)
bsr CntFnd
move.l (a7)+,a1
bra.s SpcFil
TabWrite:
movem.l a1/a6,-(a7)
move.l d2,d1
bra.s CmpTab
CntFnd: move.l a0,a1
bsr EndFnd
move.l PrefBuf,d1
sub.l d2,d1
subq.l #1,d1
asr.l #1,d1
move.l d1,d2
rts
FilSpc: move.l StrBuf,a1
SpcFil: move.b #$20,(a1)+
subq.l #1,d1
bne.s SpcFil
ChrTrn: move.b (a0)+,d0
move.b d0,(a1)+
bne.s ChrTrn
rts
CtrWrite:
movem.l a1/a6,-(a7)
bsr.s CntFnd ;Find # of leading spaces
CmpTab:
bsr FilSpc
move.l a0,-(a7)
move.l StrBuf,a0
bsr StrWrite
move.l (a7)+,a0 ;Recover beginning of Next string.
movem.l (a7)+,a1/a6
rts
StrWrite:
movem.l a1/a6,-(a7)
move.l _AbsExecBase,a6
move.l ConIO,a1
move.w #CMD_WRITE,IO_COMMAND(a1)
move.l a0,IO_DATA(a1) ;a0 points to string
move.l #-1,IO_LENGTH(a1) ;Write string ending with 0
move.l #0,IO_ACTUAL(a1) ;Clear counter
* jsr _LVOSendIO(a6)
jsr _LVODoIO(a6)
WrtChk: move.l ConIO,a1
move.l IO_ACTUAL(a1),d1
beq.s WrtChk ;Don't leave until value non-zero
movem.l (a7)+,a1/a6
rts
OpenNewScreen:
move.l a6,-(a7)
move.l #ns_SIZEOF,d0
bsr StructureAlloc
move.l d0,MyNewScreen
bsr InitTxtAttr ;Initialize the text attribute structure
lea FontName,a1 ;Get name of font.
move.l DiskFontLibrary,a6
move.l a1,(a0) ;Store font name pointer in structure.
jsr _LVOOpenDiskFont(a6);Open the font
move.l MyNewScreen,a2 ;Point to new screen structure
move.l d0,ns_Font(a2) ;Store font designation.
move.l d0,ScrFnt
move.w #640,ns_Width(a2)
move.w #400,ns_Height(a2)
move.w #2,ns_Depth(a2)
move.b #3,ns_DetailPen(a2) ;Invisible
move.b #0,ns_BlockPen(a2) ;White
move.w #MyView,ns_ViewModes(a2)
move.w #CUSTOMSCREEN,ns_Type(a2)
move.l MyNewScreen,a0 ;Get pointer the new screen structure
movea.l IntuitionLibrary,a6
jsr _LVOOpenScreen(a6) ;Get file handle, already open
move.l d0,MyScreenA ;Pointer to new screen
beq.s ScrnFail
move.l MyNewScreen,a0 ;Get pointer the new screen structure
movea.l IntuitionLibrary,a6
jsr _LVOOpenScreen(a6) ;Get file handle, already open
move.l d0,MyScreenB ;Pointer to new screen
beq.s ScrnFail
move.l (a7)+,a6
rts
ScrnFail:
lea ScrFail,a0
bsr TransIt
move.l (a7)+,a6
rts
* Close the Screen
CloseNewScreen
move.l a6,-(a7)
move.l MyNewScreen,d0 ;Point to new screen structure
beq.s NoScreenStr
move.l d0,a1
move.l ns_Font(a1),a1 ;Get pointer for textfont
move.l GraphicsLibrary,a6
jsr _LVOCloseFont(a6);Close the font
bsr FreeTxtAttr
NoScreenStr:
movea.l IntuitionLibrary,a6
move.l MyScreenA,d0
beq.s NoScrA
move.l d0,a0
jsr _LVOCloseScreen(a6)
NoScrA: move.l MyScreenB,d0
move.l d0,a0
beq.s NoScrB
jsr _LVOCloseScreen(a6)
NoScrB: move.l MyNewScreen,d0
beq.s NoNewScr
move.l d0,a1
move.l #ns_SIZEOF,d0
bsr StructFree
NoNewScr:
move.l #0,MyNewScreen
move.l (a7)+,a6
rts
ColorSet:
movem.l d0-d7/a0-a6,-(a7)
move.l MyScreenA,a3
move.l a3,a0
add.l #sc_ViewPort,a0
move.l CTable,a1
move.l #4,d0
jsr _LVOLoadRGB4(a6)
add.l #sc_BitMap,a3 ;Get up to bitmap structure
add.l #bm_Planes,a3 ;Get pointer to 1st plane.
move.l a3,PnPtr0
move.l MyScreenB,a3
move.l a3,a0
add.l #sc_ViewPort,a0
move.l CTable,a1
move.l #4,d0
jsr _LVOLoadRGB4(a6)
add.l #sc_BitMap,a3 ;Get up to bitmap structure
add.l #bm_Planes,a3 ;Get pointer to 1st plane.
move.l a3,PnPtr1
movem.l (a7)+,d0-d7/a0-a6
move.l GraphicsLibrary,a6
rts
StructFree:
move.l a6,-(a7)
move.l _AbsExecBase,a6
move.l a1,d1
beq.s IsFree
jsr _LVOFreeMem(a6)
IsFree: move.l (a7)+,a6
rts
InitTxtAttr:
move.l #ta_SIZEOF,d0
bsr.s StructureAlloc
move.l d0,MyTextAttr
move.l d0,a0
move.w #20,ta_YSize(a0)
rts
FreeTxtAttr:
move.l MyTextAttr,d0
beq.s NoTA
move.l d0,a1
move.l #ta_SIZEOF,d0
bsr.s StructFree
NoTA: move.l #0,MyTextAttr
rts
OpenNil:
move.l a6,-(a7)
move.l DosLibrary,a6
move.l #NilDev,d1
move.l #MODE_OLDFILE,d2
jsr _LVOOpen(a6)
move.l d0,NilHandle
beq.s NilFail
move.l (a7)+,a6
rts
NilFail:
lea FailNil,a0
bsr TransIt
move.l (a7)+,a6
rts
CloseNil:
move.l a6,-(a7)
move.l DosLibrary,a6
move.l NilHandle,d1
beq.s NilClosed
jsr _LVOClose(a6)
NilClosed:
move.l (a7)+,a6
rts
Second:
move.l #Command3,d1
bra.s DoIt
Third: move.l #Command4,d1
DoIt: move.l #0,d2
move.l NilHandle,d3
move.l a6,-(a7)
move.l DosLibrary,a6
jsr _LVOExecute(a6)
move.l (a7)+,a6
rts
SDelay: move.l #100,d1
jsr _LVODelay(a6)
rts
CopyFiles:
movem.l d0-d7/a0-a6,-(a7)
move.l #CommandA,d1 ;do a MakeDir for RAM:StereoDemo
bsr DoIt
tst.l d0
bne.s SuccessA
lea FailA,a0
bsr TransIt
SuccessA:
move.l #CommandB,d1
bsr DoIt
tst.l d0
bne.s SuccessB
lea FailA,a0
bsr TransIt
SuccessB:
move.l DosLibrary,a6
move.l #RamFile,RamFP
move.l #RamName,RamNP
move.l #fib_SIZEOF+6000,d0 ;Get memory for FIB and files to copy
bsr StructureAlloc
move.l d0,FIB
add.l #fib_SIZEOF,d0
move.l d0,FileBuffer
move.l #Stereo,d1 ;Point to name Stereo
move.l #ACCESS_READ,d2
jsr _LVOLock(a6) ;Get lock
tst.l d0 ;See if null
beq.s NotThere ;Is on current director
move.l d0,d1 ;Get ready to unlock (not open)
jsr _LVOUnLock(a6) ;Release it.
bra.s CurDir ;Current directory if got to here
NotThere:
bsr CopyPaths
bra.s CopyDone
CurDir: move.l #WndName,d1
bsr CopyOne
move.l #Wnd2Name,d1
bsr CopyOne
CopyDone:
move.l #Ram2Name,RamNP
move.l #Ram2File,RamFP
move.l #CRun,d1
bsr CopyC
move.l #CAssign,d1
bsr CopyC
move.l #CDelete,d1
bsr CopyC
move.l FIB,a1
move.l #fib_SIZEOF+6000,d0
bsr StructFree
move.l #CommandC,d1
bsr DoIt ;Assign c: ram:c
movem.l (a7)+,d0-d7/a0-a6
rts
CopyC: addq.l #2,d1 ;Get to name without c:
move.l d1,-(a7)
subq.l #2,d1 ;Back to c:name
bra.s DoOpen
CopyPaths:
move.l #WndName,d1
bsr CopyFull
move.l #Wnd2Name,d1
CopyFull:
move.l d1,-(a7) ;Save pointer to short file name
move.l RemPath,a1 ;Get location for rest of string
bsr CopyName ;Append name to path
move.l #FullPath,d1 ;Set to open full path.
bra.s DoOpen ;Open and copy the file
CopyOne:
move.l d1,-(a7) ;Save pointer to file name
DoOpen: move.l #MODE_OLDFILE,d2
jsr _LVOOpen(a6)
move.l d0,DosFileHandle
beq.s NoFile
move.l DosFileHandle,d1
move.l FileBuffer,d2
move.l #6000,d3
jsr _LVORead(a6) ;Read file
move.l d0,FileLength
move.l DosFileHandle,d1
jsr _LVOClose(a6) ;Close it
move.l (a7)+,d1 ;Recover file name
move.l RamNP,a1
bsr CopyName
move.l RamFP,d1
move.l #MODE_NEWFILE,d2
jsr _LVOOpen(a6)
move.l d0,DosFileHandle
move.l d0,d1 ;Filehandle into d1
move.l FileBuffer,d2
move.l FileLength,d3
jsr _LVOWrite(a6)
move.l DosFileHandle,d1
jsr _LVOClose(a6)
rts
NoFile: move.l (a7)+,d1
bsr SDelay
rts
CopyName:
move.l d1,a0
CpyChr: move.b (a0)+,d0
move.b d0,(a1)+
bne.s CpyChr
rts
CopyPath:
move.l $c(a5),a0 ;Get pointer to pointer to name
move.l (a0),a0 ;Get pointer to name
lea FullPath,a1
MovChr: move.b (a0)+,d0
move.b d0,(a1)+
bne.s MovChr
FstLet: move.b -(a1),d0 ;Get last byte
bclr #5,d0 ;Mask off lower-case bit
cmp.b #'S',d0 ;See if 1st letter of Stereo
bne.s FstLet
move.l a1,RemPath ;Point to remainder of filename path
rts
dseg
RamFP: ds.l 1 ;Pointer to ram file
RamNP: ds.l 1 ;Pointer to name for ram file
CurAmy: dc.l 0 ;Current location in AmyTab
AmyTab: dc.l AmyOne,AmyTwo,AmyThree,AmyFour,0
TabAmy: dc.l AmySix,AmySeven,AmyEight,0
DaveTab:
dc.l DaveOne,DaveTwo,0
LateAmy:
dc.l Amy1,DaveThree,DaveFour,NxtFive,NxtSix,NxtSev,NxtEgt,NxtNin
dc.l NxtTen,NxtElv,NxtTwl,NxtThr,NxtFrt,NxtFif,NxtSxt,NxtSvt
dc.l NxtEtt,NxtNnt,NxtTwt,NxtTt1,NxtTt2,NxtTt3,0
LstTab: dc.l Warning,Wrn2,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,Lst1,Lst2
dc.l NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul
dc.l Lst3,Lst4,Lst5,Lst6,Lst7,Lst8,Lst9,NxtNul,NxtNul,NxtNul,NxtNul,NxtNul,Lst10,Lst11,Lst12,0
PendIO: dc.l 0
RemPath:
dc.l 0
FileLength:
dc.l 0
DosFileHandle:
dc.l 0
FileBuffer:
dc.l 0 ;Pointer to buffer for file copying.
Error: dc.l 0
MyName: dc.l 0
FIB: dc.l 0
CurrentLock:
dc.l 0
OldLock:
dc.l 0
WBMsg: dc.l 0
NilHandle:
dc.l 0
PrefBuf:
dc.l 0
MyTextAttr:
dc.l 0
StrBuf: dc.l 0
WTBuf: dc.l 0
MyNewScreen:
dc.l 0
MyScreenA:
dc.l 0
MyScreenB:
dc.l 0
ScrFnt: dc.l 0
MyBuffer:
dc.l 0,0 ;Keyboard input buffer
OutBuf: dc.l 0 ;Output buffer for narrator.
SndBuf: dc.l 0 ;Audio buffer
MsgPort:
dc.l 0
MsgPortN:
dc.l 0 ;Message port for narrator
MsgPortC:
dc.l 0 ;Message port for console
Signal: dc.l 0
SignalN:
dc.l 0 ;Pointer for Narrator Signal
SignalC:
dc.l 0 ;Pointer of Console Signal
ConIO:
dc.l 0 ;Pointer for structure for console io
SpeakIO: ;Pointer for structure for narrator io
dc.l 0
TranslatorLibrary:
dc.l 0
DiskFontLibrary:
dc.l 0
AudChn: dc.b 3,5,10,12
DZ: dc.l 1
*SpriteSave:
* ds.l 1
*SpriteBuffer:
* dc.l 0
FirstY: ds.l 1
FirstX: ds.l 1
CTable: dc.l CTable2
Savea5: ds.l 1
Savea6: ds.l 1
InitSP: ds.l 1
ErrNum: dc.l 0
SinTab: ds.l 1
CosTab: ds.l 1
ThetaTotal:
ds.l 1
ThetaNew:
ds.l 1
TopOffset:
ds.l 1
BottomOffset:
ds.w 1
LastTop:
dc.w 0
MouCnt: ds.w 1
LastMouse:
ds.l 1
DTheta: dc.l 128
xoffset:
ds.l 1
yoffset:
ds.l 1
zoffset:
ds.l 1
z: ds.l 1
rho: ds.l 1
xtemp: ds.l 1
ytemp: ds.l 1
SegLength:
ds.w 1
Leaf: ds.w 1
octcod:
dc.w OCTANT1,OCTANT4,OCTANT5,OCTANT8,OCTANT2,OCTANT3,OCTANT6,OCTANT7
PagNum: ds.l 1
Theta: dc.l 1
Phi: dc.l 1
DPhi: dc.l 0
SinTheta:
dc.w 1
CosTheta:
dc.w 1
SinPhi: dc.w 1
CosPhi: dc.w 1
IntuitionLibrary: ;Library pointers will be null until opened.
dc.l 0
GraphicsLibrary:
dc.l 0
DosLibrary:
dc.l 0
MyNewWindow:
ds.l 1
MyWindow:
ds.l 1
bytwidth:
ds.l 1
PortView:
ds.l 1
* The 4 elements of the following color table are practically perfect
* for the 3D filters I'm using.
CTable2:
dc.w $550,$d40,$490,$d90 ;green was $0a0
MCTable:
dc.w $fff,0,0,$f0
SColor: ds.w 4
PnPtr0: dc.l 0 ;,0,0,0,0,0,0,0 ;Pointer for 8 bit planes.
PnPtr1: dc.l 0 ;,0,0,0,0,0,0,0 ;Pointer for 8 bit planes.
sintab: dc.w 0,$11E,$23C,$359,$477,$594,$6B1,$7CD
dc.w $8E9,$A03,$B1D,$C36,$D4E,$E66,$F7C,$1090
dc.w $11A4,$12B6,$13C7,$14D6,$15E4,$16F0,$17FA,$1902
dc.w $1A08,$1B0C,$1C0E,$1D0E,$1E0C,$1F07,$2000,$20F6
dc.w $21EA,$22DB,$23CA,$24B5,$259E,$2684,$2767,$2847
dc.w $2923,$29FD,$2AD3,$2BA6,$2C75,$2D41,$2E0A,$2ECE
dc.w $2F90,$304D,$3107,$31BD,$326F,$331D,$33C7,$346D
dc.w $350F,$35AD,$3646,$36DC,$376D,$37FA,$3882,$3906
dc.w $3986,$3A01,$3A78,$3AEA,$3B57,$3BC0,$3C24,$3C83
dc.w $3CDE,$3D34,$3D85,$3DD2,$3E19,$3E5C,$3E9A,$3ED3
dc.w $3F07,$3F36,$3F61,$3F86,$3FA6,$3FC2,$3FD8,$3FEA
dc.w $3FF6,$3FFE
costab: dc.w $3FFF,$3FFE,$3FF6,$3FEA
LeftEye:
ds.l 1
RightEye:
ds.l 1
PointCount:
ds.w 1
FrmCnt: ds.w 1
LoopCnt:
dc.w 0
AName: dc.w -241,50,-194,-50,-187,-50,-153,50,-162,50,-174,14
dc.w -214,14,-231,50,-241,50
dc.w -210,6,-191,-36,-178,6,-210,6
MName: dc.w -132,50,-106,-50,-97,-50,-88,-17,-68,-50,-61,-50,-54,50
dc.w -62,50,-68,-33,-87,-4,-93,-4,-102,-31,-125,50,-132,50
IName: dc.w -20,50,-20,41,-12,41,0,-41,-9,-41,-9,-50,20,-50
dc.w 20,-41,9,-41,-3,41,5,41,5,50,-20,50
GName:
dc.w 51,50,67,-50,128,-50,124,-25,113,-25,116,-41,77,-41
dc.w 64,41,100,41,103,25,87,25,87,18,127,18,127,25
dc.w 114,25,109,50,51,50
AName2: dc.w 149,50,196,-50,203,-50,237,50,228,50,216,14
dc.w 176,14,159,50,149,50
dc.w 180,6,199,-36,212,6,180,6
TXTURE: ds.w 1
DosName:
dc.b 'dos.library',0
DiskFontName:
dc.b 'diskfont.library',0
IntuitionName:
dc.b 'intuition.library',0
GraphicsName:
dc.b 'graphics.library',0
FontName:
dc.b 'diamond.font',0
DubFed: dc.b $a,$a,0
LinFed: dc.b $a,0
SprSts: dc.b 0
IntMes0:
dc.b 'Animated 3D Graphics',$a,$a,0
dc.b 'Software',$a,$a,0
dc.b 'by',$a,$a,0
dc.b 'David M. McKinstry',$a,$a,0
IntMes1:
dc.b 'Copyright ',$a9,' 1987-88',$a,$a,0
IntMes2:
dc.b 'View on RGB analog monitor using "3D Glasses",',$a,0
dc.b 'Red for left eye and Green for right!',$a,$a,0
AnCmd: dc.b 'Return to Intuition I',$a,$a,0
dc.b 'Terminate Program Control C',$a,$a,0
NewWindTitle:
dc.b 'Stereoscopic Demonstration',0
NarDev_Name:
dc.b 'narrator.device',0
ConDev_Name:
dc.b 'console.device',0
AudDev_Name:
dc.b 'audio.device',0
TranslatorName:
dc.b 'translator.library',0
WhiteScript:
dc.b $9b,'40;31m',0
OrangeScript:
dc.b $9b,'40;33m',0
Remem: dc.b 'If you want to run anuhther program that requires uce of the floppy drives, '
dc.b 'press I to stop the animation and get back to in2ihshun!',0
Caution:
dc.b 'The prowgram can only be terminated by uzing control see, '
dc.b 'while the animation is proceeding!',0
DefStr: dc.b 'The default for this demo is 1 pass through.',0
dc.b 'If you want the animation to run forever, press the space bar'
dc.b 'within the next 4 seconds!',0
SpcStr: dc.b 'Press the space bar for continuous looping!',0
HomeIt: dc.b 12,$a,$a,9,9
MyString:
dc.b 'Press the space bar to continue!',0
MenStr: dc.b 'This demonstration may be freely dooplicated and used by anyone, '
dc.b 'as long is it is kept at a unit and includes the above copyright notice.',0
dc.b 'In addition, the drower StereoDemo and all its files must be kawpeed without '
dc.b 'changing them in order for the demo to run correctly.',0
Mes1: dc.b 'Befowr we start this demo, place the 3 D glasses with the red filter'
dc.b 'in front of yowr left I and green filter in front of yowr right I.',0
dc.b 'You should be able to look through each filter and see a single image.',0
dc.b 'You may have to adjust the intensity of the monitor to get the '
dc.b 'best results.',0
dc.b 'Do not sit too clowsleee to the monitor or you may have trouble fusing the 2 images.',0
dc.b 'This becomes more critikal if the size of the screen is bigger.',0
Mes2: dc.b 'Only the Amiga has the grafix rehzilushun, cullour, and speed '
dc.b 'that permits real-time stereoscopic animation.',0
Mes3: dc.b 'Amee!',0
dc.b 'Please dew not be so critikal',0
dc.b 'After all, you can not chew gum either.',0
dc.b 'But you dew have sound and graphics ko-prawcessors, 4 thousand '
dc.b '9T6 cuhlurs, and as with this demo, a 6 hundred forty by 4 hundred display.',0
dc.b 'Of course, this is standard on every computer in the Commodore Amiga line.',0
dc.b 'B4 you interrupted me, I was about to say that the uhbility '
dc.b 'of the Amiga for real-time animation makes it an ideal educational tewl.',0
dc.b 'Any figure can be rowtated about 3 ahxeez and moved any distance from the viewer.',0
*Mes8: dc.b 'How about a flying rowz-eht?',0
*Mes9: dc.b 'and a shuttle kraft?',0
TitleL: dc.b 'Stereoscopic Screen',0
TitleR: dc.b ' Stereoscopic Screen',0
NilDev: dc.b 'NIL:',0
Null: dc.b 0
StereoName:
dc.b 'StereoFiles',0
FailNil:
dc.b 'Sorry, the NIL device could not be opened',0
ScrFail:
dc.b 'Sorry, Custom Screen could not be opened',0
CommandA:
dc.b 'MakeDir RAM:StereoDemo',0
CommandB:
dc.b 'MakeDir RAM:c',0
CommandC:
dc.b 'Assign c: ram:c',0
CommandD:
dc.b 'Assign c: sys:c',0
CommandE:
dc.b 'Delete RAM:c all',0
Command3:
dc.b 'Run > NIL: RAM:StereoDemo/Window',0
Command4:
dc.b 'Run > NIL: RAM:StereoDemo/Window2',0
EndCmd: dc.b 'Delete RAM:StereoDemo all',0
NoLock: dc.b 'No lock available',0
FailA: dc.b 'Could not MakeDir',0
FailB: dc.b 'Could not change directory',0
FailC: dc.b 'Could not copy files',0
AmyOne: dc.b 'Hello, I am an Amiga personal computer.',0
AmyTwo: dc.b 'Amigaz R the only personal computers with the speed, colour, and detail'
dc.b 'That permits real-time stereoscopic animation.',0
AmyThree:
dc.b 'I am sorry that my animation is sow slow when I am talking,',0
AmyFour:
dc.b 'but the other personal computers can not even draw and chew gum at the same time.',0
AmySix: dc.b 'Yooo Big Dummeee!',0
AmySeven:
dc.b 'I was not talking about their gum chewing!',0
AmyEight:
dc.b 'They can not dew multi-tasking and animation!',0
DaveOne:
dc.b 'Well yes, hardly any other personal computer can do animation, let alone multi-tasking!',0
DaveTwo:
dc.b 'and Amiga has had a completely working multi-tasking operating system for about 3 years!',0
Amy1: ;Now it's Amy again
dc.b 'Lets pull down our custom screen and see whats going on behind it!',0
DaveThree:
dc.b 'OK!',0
DaveFour:
dc.b 'Whats this?',0
NxtFive:
dc.b 'Well,',0
NxtSix: dc.b ' On our right is a computer from big blue',0
NxtSev: dc.b 'and on our left is the computer for - Quote - the rest of us - UnQuote',0
NxtEgt: dc.b 'Oh?',0
NxtNin: dc.b 'And just who are the rest of us?',0
NxtTen: dc.b ' ',0
NxtElv: dc.b 'They are the extremely ritch!',0
NxtTwl: dc.b 'Those are not very good simulations Amy!',0
NxtThr: dc.b 'They are soooooow slowoooooo!',0
NxtFrt: dc.b 'You are cheating with a lot of delay loops!',0
NxtFif: dc.b 'Arnt you?',0
NxtSxt: dc.b 'Well!',0
NxtSvt: dc.b 'Those computers seem that slow to me!',0
NxtEtt: dc.b 'and I have nothing more to say!',0
NxtNnt: dc.b 'Well its about time you were quiet!',0
NxtTwt: dc.b 'Now let me fihnish what I wanted to say!',0
NxtTt1: dc.b 'Those karakteristics already mentioned, along with the Amigaz sound genaerating uhbilities '
dc.b 'make it ideal for uce in science education.',0
NxtTt2: dc.b 'Some obvious applications for stereoscopic grafix include '
dc.b 'vectors and vector fieldzs in fizzix and mathematics,',0
NxtTt3:
dc.b 'and krisolograffee and mowlekular models in fizzix, khemistree, and the life and earth sciences.',0
NxtNul: dc.b ' '
dc.b ' ',0
WndName:
dc.b 'Window',0
Wnd2Name:
dc.b 'Window2',0
FileOpen:
dc.b 'File has been opened',0
FileRead:
dc.b 'File has been read',0
FileCopy:
dc.b 'File has been copied',0
Warning:
dc.b 'Red alert! Red alert!',0
Wrn2: dc.b 'Alien invader sighted! ',0
Lst1: dc.b 'You can just Relax Amy.',0
Lst2: dc.b 'Its just a friendly flying rowz-eht?',0
Lst3: dc.b 'You know, we really should forgive Amy for her outbursts!',0
Lst4: dc.b 'After all, she is extremely talented and does not believe she is being'
dc.b 'prawperly rehkognized!',0
Lst5: dc.b 'But, she is only about 3 years old and has not learned much tolerance '
dc.b 'or dihplo-muhsee yet!',0
Lst6: dc.b 'Before we leave, I would like to point out that the '
dc.b 'power is in the Amiga and AmigaDOS.',0
Lst7: dc.b 'All the kahlkulations and display for this demo are done in real time.',0
Lst8: dc.b 'The total number of bytes in this demo is about twenty-one thousand.',0
Lst9: dc.b 'That means that a single floppy could hold over forty programs like this 1!',0
Lst10: dc.b 'Well!',0
Lst11: dc.b 'Good bye friendly row-seht',0
Lst12: dc.b 'and good bye everyone!',0
CRun: dc.b 'C:Run',0
CAssign:
dc.b 'C:Assign',0
CDelete:
dc.b 'C:Delete',0
Stereo: dc.b 'Stereo',0
RamFile:
dc.b 'RAM:StereoDemo/'
RamName:
ds.b 80
FullPath:
ds.b 256
Ram2File:
dc.b 'Ram:c/'
Ram2Name:
ds.b 80
END